package com.ag.zrt.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.common.BaseAction;
import com.ag.zrt.service.InformationService;
import com.ag.bean.TbInformation;


/* 此类作废*/
@Controller("findInformationAction")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class FindInformationAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9016664669524376770L;
	private List<TbInformation> infoList;
	@Resource(name = "InformationService")
	private InformationService informationService;
	private int currentPage; // 翻页前的页数
	private int totalPages; // 总页数
	private int nextOrPrev = 1; // 上一页或下一页标志位 //默认为1
	private String type = "all"; // 查找方式（历式简报（被删的），未读简报，全部（除被删）） 默认是全部
	private int totalInformation = 0;// 简报总数
	private int newInfo = 0; // 未读简报
	private int sortWay = 100;// 排序标志，100代表按日期排序（默认），101代表类型，102代表审核状态

	public int getSortWay() {
		return sortWay;
	}

	public void setSortWay(int sortWay) {
		this.sortWay = sortWay;
	}

	public int getNewInfo() {
		return newInfo;
	}

	public void setNewInfo(int newInfo) {
		this.newInfo = newInfo;
	}

	public int getTotalInformation() {
		return totalInformation;
	}

	public void setTotalInformation(int totalInformation) {
		this.totalInformation = totalInformation;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getType() {
		return type;
	}

	public int getNextOrPrev() {
		return nextOrPrev;
	}

	public void setNextOrPrev(int nextOrPrev) {
		this.nextOrPrev = nextOrPrev;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	public int getTotalPages() {
		return totalPages;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public List<TbInformation> getInfoList() {
		return infoList;
	}

	public void setInformationService(InformationService informationService) {
		this.informationService = informationService;
	}

	/*public String find() throws Exception {
		// TODO Auto-generated method stub
		// currentPage += 1;
		infoList = informationService
				.findaByPage(currentPage, nextOrPrev, type, sortWay);
		totalPages = informationService.getTotalPages(type);
		if (totalPages > 0) {
			currentPage = informationService
					.getNewPage(currentPage, nextOrPrev);
		} else {
			currentPage = 1;
			totalPages = 1;
		}
		totalInformation = informationService.countAll(type);
		newInfo = informationService.countAll("newInformation");//未读信息
		return "find_info_succ";
	}*/

	public int getCurrentPage() {
		return currentPage;
	}

	/*
	 * public String findNewInformation() throws Exception { // TODO
	 * Auto-generated method stub // currentPage += 1; infoList =
	 * informationService.findaByPage(currentPage, nextOrPrev, "new");
	 * totalPages = informationService.countAll("new"); if (totalPages > 0) {
	 * currentPage = informationService.createNewPage(currentPage, nextOrPrev);
	 * } else { currentPage = 1; totalPages = 1; }
	 * System.out.println(currentPage); return "find_info_succ"; }
	 * 
	 * public int getCurrentPage() { return currentPage; }
	 */

}
